Skip to content

7124: Add focus and maximizedFocus launch modes - #7873

Merged
10 commits merged into
microsoft:masterfrom
Don-Vito:fet/7124-startfocused
Oct 14, 2020
Merged

10 commits merged into
microsoft:masterfrom
Don-Vito:fet/7124-startfocused

Conversation

@Don-Vito

@Don-Vito Don-Vito commented Oct 9, 2020 •

Copy link
Copy Markdown
Contributor

This commit introduces two new launch modes: focus and maximizedFocus.

  • Focused mode, behaves like a default mode, but with the Focus Mode
    enabled.
  • Maximized focused mode, behaves like a Maximized mode, but with the
    Focus Mode enabled.

There two ways to invoke these new modes:

  • In the settings file: you set the "launchMode" to either "focus" or
    "maximizedFocus"
  • In the command line options, you can path -f / --focus, which is
    mutually exclusive with the --fullscreen, but can be combined with the
    --maximized:
    • Passing -f / --focus will launch the terminal in the "focus" mode
    • Passing -fM / --focus --maximized will launch the terminal in the
      "maximizedFocus" mode

This should resolve a relevant part in the command line arguments
mega-thread #4632

Closes #7124
Closes #7825
Closes #7875

… If one of them is set, focusedMode should be toggled on startup
@ghost ghost added Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Oct 9, 2020
@zadjii-msft

Copy link
Copy Markdown
Member

I love this. I think you've done the focused mode thing exactly right. My one concern - I'd yank the maximizedFocus mode. In my opinion, that's just the same thing as fullscreen mode 😄

@zadjii-msft Mike Griese (zadjii-msft) added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 9, 2020
@Don-Vito

Don-Vito commented Oct 9, 2020

Copy link
Copy Markdown
Contributor Author

I love this. I think you've done the focused mode thing exactly right. My one concern - I'd yank the maximizedFocus mode. In my opinion, that's just the same thing as fullscreen mode 😄

The only difference from the fullscreen is that in the maximized focused mode, you still see the taskbar (not sure how useful it is). Added this mode as it seems that in was originally mentioned in the feature request (#7124): "I want to have maximized and focused mode when app is launch" (#7124 (comment))

Please let me know if you prefer me to delete anyway.

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 9, 2020
@zadjii-msft

Copy link
Copy Markdown
Member

Oh, fair point! Then I'm totally cool with this. I don't hate maximizedFocus either - I think maximized|focus would be wrong, because that would imply the whole set is flags that could be combined (they aren't). It's basically either maximizedFocus or focusMaximized, and I don't feel like there's a tangible difference between the two, so let's go with what's already been implemented 😛

@Don-Vito

Don-Vito commented Oct 9, 2020

Copy link
Copy Markdown
Contributor Author

Oh, fair point! Then I'm totally cool with this. I don't hate maximizedFocus either - I think maximized|focus would be wrong, because that would imply the whole set is flags that could be combined (they aren't). It's basically either maximizedFocus or focusMaximized, and I don't feel like there's a tangible difference between the two, so let's go with what's already been implemented 😛

Yay :)
Should I add some UTs? If so - can you please guide me to the framework that I can base on?
If not - should I mark this as "Ready for review"? (I am quite new with the Draft PRs, work with Azure DevOps mostly).

@zadjii-msft

Copy link
Copy Markdown
Member

Should I add some UTs?

Bless your soul ☺️

In this specific case, since this is such a UI-dependent feature, I think we're cool not adding any unit tests. The enum parsing is already pretty well tested, and I'm not sure we've got any sort of framework for testing the state of the Win32 window. I'd definitely mark this as "Ready for Review" 😄

@zadjii-msft Mike Griese (zadjii-msft) removed their assignment Oct 9, 2020
@Don-Vito
Don-Vito marked this pull request as ready for review October 9, 2020 16:04
@Don-Vito Don-Vito changed the title 7124: Add focused and maximizedFocused launch modes 7124: Add focus and maximizedFocus launch modes Oct 9, 2020
@Don-Vito

Don-Vito commented Oct 10, 2020 •

Copy link
Copy Markdown
Contributor Author

Mike Griese (@zadjii-msft) - sorry for pushing another change after the approval (I was sure that this new commit will reset it, but for some reason it didn't).

I have noticed that in the megathread (#4632) there is also a request to add command-line option for this. So added it as well.

@Don-Vito
Don-Vito marked this pull request as draft October 10, 2020 09:49
@Don-Vito
Don-Vito marked this pull request as ready for review October 10, 2020 12:49

@zadjii-msft Mike Griese (zadjii-msft) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you a mind reader?

I was gonna go ahead and sneak the cmdline argument in after this PR merged, but hey, you've gone and already done it. Thanks for the diligence! I quite like the elegance of -Mf for combining focus and maximized too

@zadjii-msft Mike Griese (zadjii-msft) removed their assignment Oct 12, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we'll need to update the schema in doc/cascadia! This looks excellent otherwise.

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 13, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 13, 2020
@Don-Vito

Copy link
Copy Markdown
Contributor Author

Added the schema to the cascadia docs. Should I do anything beyond validating that it works on different profile?
This schema corresponds to the documentation PR I put in the docs repo (MicrosoftDocs/terminal#158)

@lhecker Leonard Hecker (lhecker) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can drop MaximizedFocusMode.
You could get the same effect by calling wt.exe --focus --maximized instead, couldn't you?

// -F,--fullscreen: Fullscreens the window on launch
auto maximizedCallback = [this](int64_t /*count*/) {
_launchMode = winrt::Microsoft::Terminal::Settings::Model::LaunchMode::MaximizedMode;
_launchMode = (_launchMode.has_value() && _launchMode.value() == winrt::Microsoft::Terminal::Settings::Model::LaunchMode::FocusMode) ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop the winrt::Microsoft::Terminal::Settings::Model:: prefix, because the file already imports the namespace. 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Done!

@Don-Vito

Copy link
Copy Markdown
Contributor Author

I believe you can drop MaximizedFocusMode.
You could get the same effect by calling wt.exe --focus --maximized instead, couldn't you?

Leonard Hecker (@lhecker) - please guide me here. How do you suggest to encode the combination of --focus --maximized instead?

@Don-Vito

Copy link
Copy Markdown
Contributor Author

Dustin L. Howett (@DHowett) - sorry for nagging, but CI is somewhat harsh with me today and I am not sure if I can somehow unblock this PR 😄

  • The github spelling complains about something I already fixed (I wrote betwen instead of between).
  • The OutputTests::BasicReadConsoleOutputATest fails - though it passes locally for me, and I can hardly follow the link between it and the change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, excellent stuff. Thank you!

@ghost ghost added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Oct 14, 2020
@DHowett

Copy link
Copy Markdown
Member

I have several questions regarding the feature and the PR

  • This is my first PR, please be gentle

This is excellent work for a first PR -- though your other work merged first! 😄
We're happy to have you.

  • I hesitated between introducing new launch modes or adding a separate setting for "startInFocused" mode. I >preferred not to introduce a new parameter, was this a good decision?

Looks like we went w/ a parameter.

  • Didn't updated the documentation yet - wanted to hear your opinion first.

All set!

  • Not sure how to test this in UT. Didn't find UT for other modes.

Mike Griese (@zadjii-msft) summed it up quite nicely.

  • Didn't add those modes to args. Please let me know if required (and if so, the names of the options)

All set again! 😁

@DHowett Dustin L. Howett (DHowett) added the AutoMerge Marked for automatic merge by the bot when requirements are met label Oct 14, 2020
@ghost

Copy link
Copy Markdown

Hello Dustin L. Howett (@DHowett)!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost
ghost merged commit f86045e into microsoft:master Oct 14, 2020
Carlos Zamora (carlos-zamora) pushed a commit that referenced this pull request Oct 30, 2020
## Summary of the Pull Request
Since we've started working on the Settings UI, a few settings have been added on `main`. This adds those missing settings over. 

## References
Missing settings include...
- #7364: `disableAnimations`
- #7873: `launchMode` `focus` and `maximizedFocus`
- #7793: `bellStyle`

## Validation Steps Performed
Verified that those settings appear properly in the Settings UI.
@ghost

Copy link
Copy Markdown

🎉Windows Terminal Preview v1.5.3142.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Settings Issues related to settings and customizability, for console or terminal AutoMerge Marked for automatic merge by the bot when requirements are met hacktoberfest-accepted Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add command line flag to start in focus mode focusMode option for launchMode setting Focus mode on app startup/launch

4 participants